<!--
 * @FilePath: /lieshou-app/components/z-main-tab.vue
-->

<template>
	<view class="z-main-tab">
		<uv-row justify="space-between" gutter="10">
			<uv-col span="3" v-for="(item, index) in mainTab" :key="index" @click="activeTab(item, index)">
				<view class="grad-list">
					<image class="icon" :src="item.src"></image>
					<view :class="{ 'grid-text': true, 'active': active === item.nid }">
						{{ item.name }}
					</view>
				</view>
			</uv-col>
		</uv-row>
	</view>
</template>

<script>

const mainTab = [{
	name: '脱单必修',
	nid: 'tdbx',
	src: '/static/image/icon/grad-tab-icon1.png'
}, {
	name: '恋爱必修',
	nid: 'labx',
	src: '/static/image/icon/grad-tab-icon2.png'
}, {
	name: '婚姻必修',
	nid: 'hybx',
	src: '/static/image/icon/grad-tab-icon3.png'
}, {
	name: '进阶技巧',
	nid: 'jjjq',
	src: '/static/image/icon/grad-tab-icon4.png'
}]
export default {
	props: ['active'],
	name: "z-nav",
	data() {
		return {
			mainTab
		};
	},
	methods: {
		activeTab(item, index) {
			this.$emit('activeTab', item)
		},
	}
}
</script>

<style lang="scss" scoped>
.z-main-tab {
	width: 694rpx;
	height: 160rpx;
	margin: 0 auto;
	margin-top: 32rpx;
	border-radius: 14rpx;
	background: linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%), rgba(255, 255, 255, 0.3);
	border: 2rpx solid rgba(255, 255, 255, 1);


	.grad-list {
		text-align: center;

		.icon {
			width: 72rpx;
			object-fit: cover;
			height: 72rpx;
			margin-top: 26rpx;
		}

		.grid-text {
			font-size: 24rpx;
			color: #333;

			&.active {
				color: #333;
				font-weight: bolder !important;
			}
		}
	}
}
</style>